<template>
  <div>
    <div>
      <!-- <button @click="$store.commit('setToken')">改token</button> -->
      <!-- <button @click="$store.commit('user/setToken')">改token</button> -->
      <button @click="$store.commit('setToken')">改token</button>
      <button @click="$store.commit('setName')">改name</button>
    </div>
    <div>用户token{{ $store.state.user.token }}</div>
    <div>用户学校{{ $store.state.user.school.name }}</div>
    <div>设置name{{ $store.state.setting.name }}</div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  methods: {
    ...mapMutations(["setName"]),
    // 如果带有命名空间，可以第一个参数加入一个可选的模块名字符串
    ...mapMutations("user", ["setToken"]),
  },
};
</script>

<style>
</style>